// RenderBRDFSphere.cpp : implementation file
//

#include "stdafx.h"
#include "MFCD3D11Test.h"
#include "RenderBRDFSphere.h"


// CRenderBRDFSphere

IMPLEMENT_DYNAMIC(CRenderBRDFSphere, CDockablePane)

CRenderBRDFSphere::CRenderBRDFSphere()
{

}

CRenderBRDFSphere::~CRenderBRDFSphere()
{
}


BEGIN_MESSAGE_MAP(CRenderBRDFSphere, CDockablePane)
	ON_WM_CREATE()
	ON_WM_SIZE()
	ON_WM_SETFOCUS()
END_MESSAGE_MAP()



// CRenderBRDFSphere message handlers
int CRenderBRDFSphere::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  Add your specialized creation code here
	// TODO:  Add your specialized creation code here
#define  ID_TMP3  144447
	m_SphereRender.Create(NULL, NULL, WS_CHILD|WS_VISIBLE, CRect(0,0,10,10), this, ID_TMP3);

	CRect rcClient;
	GetClientRect(&rcClient);
	rcClient.DeflateRect(0,0,0,20);
	m_SphereRender.MoveWindow(0,0,rcClient.Width(), rcClient.Height()-20, FALSE);

	return 0;
}


void CRenderBRDFSphere::OnSize(UINT nType, int cx, int cy)
{
	CDockablePane::OnSize(nType, cx, cy);

	// TODO: Add your message handler code here
	if(m_SphereRender.GetSafeHwnd() && nType != SIZE_MINIMIZED)
	{
		m_SphereRender.SetWindowPos(&CWnd::wndTop, 0, 0, cx, cy-20, SWP_NOMOVE);
	}
}


void CRenderBRDFSphere::OnSetFocus(CWnd* pOldWnd)
{
	CDockablePane::OnSetFocus(pOldWnd);

	// TODO: Add your message handler code here
	if(m_SphereRender.GetSafeHwnd())
	{
		m_SphereRender.SetFocus();
		CString strTmp;
		strTmp.Format(_T("Sphere: %d vertices, %d faces\n"), m_SphereRender.GetNumVertices(), m_SphereRender.GetNumIndices()/3);
		theApp.OutputString(strTmp);
	}
}
